package pl.poznan.put.cs.idss.particlefilter.enviroment;

import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import pl.poznan.put.cs.idss.particlefilter.agent.Agent;
import pl.poznan.put.cs.idss.particlefilter.ui.Board;

/**
 * Mapa świata - w zasadzie tylko kontener na obrazek.
 * 
 * @author koki
 * 
 */
public class WorldMap {

	private int width = 800;
	private int height = 400;
	private int borderWidth = 20;

	private Image worldMapImage;
	private Image borderImage;

	private Board relatedBoard;

	public Image getWorldMapImage() {
		return worldMapImage;
	}

	public Image getBorderImage() {
		return borderImage;
	}

	public WorldMap(int width, int height) throws IOException {

		this.width = width;
		this.height = height;

		this.setMapImage();
		this.setBorderImage();

	}

	public void relateBoard(Board board) {
		setRelatedBoard(board);
	}

	private void setBorderImage() throws IOException {
		borderImage = Toolkit.getDefaultToolkit().getImage(
				(Agent.class.getResource("/border.png")));
	}

	private void setMapImage() throws IOException {
		worldMapImage = Toolkit.getDefaultToolkit().getImage(
				(Agent.class.getResource("/map.png")));
	}

	public int getWidth() {
		return width;
	}

	public int getHeight() {
		return height;
	}

	public int getBorderWidth() {
		return borderWidth;
	}

	public Board getRelatedBoard() {
		return relatedBoard;
	}

	private void setRelatedBoard(Board relatedBoard) {
		this.relatedBoard = relatedBoard;
	}

}
